<template>
  <view class="order-item" @click="toDetail">
    <view class="ord-no">订单编号：{{ props.detail.order_sn }}</view>
    <view class="car-info">
      <image class="car-img" :src="props.detail?.car_images[0]"></image>
      <view class="info-right">
        <view class="tit two-ellipsis">
          {{ props.detail.brand_name }}
          {{ props.detail.series_name }}
          {{ props.detail.car_title }}
        </view>
        <view class="addr">{{ props.detail.shop_name }}</view>
        <!-- <view class="paizhao">{{ props.detail.shop_mobile }}</view> -->
      </view>
    </view>

    <!-- "deposit_status": 0,定金支付状态0未支付1已支付 <number>
"status:状态0未处理1已完成2绑定销售3绑定库存车辆4出库中 <number> -->
    <view class="item-btm">
      <view class="price">订金{{ props.detail.pay_deposit }}</view>
      <view class="btn down" v-if="props.detail.deposit_status == '0'">未支付</view>
      <block v-else>
        <view class="btn payed" v-if="props.detail.status == '1'">已完成</view>
        <view class="btn returned" v-else-if="props.detail.status == '4'">出库中</view>
        <view class="btn down" v-else-if="props.detail.status == '-1'">已取消</view>
        <view class="btn returned" v-else>交付中</view>
      </block>
      <!-- <bloce v-if="props.detail.status != '0' && props.detail.status">
        <view class="btn payed" v-if="props.detail.status == '1' || props.detail.status == '2'">交付中
        </view>
        <view class="btn returned" v-if="props.detail.status == '3'">交付完成</view>
      </bloce>
      <block v-else>
        <view class="btn down" v-if="props.detail.deposit_status == '0'">未支付</view>
        <view class="btn payed" v-if="props.detail.deposit_status == '1'">出库中</view>
      </block> -->
    </view>
  </view>
</template>

<script setup>
import { router } from "@/path/router";
const props = defineProps({
  detail: Object,
})
function getPrice(num = 0) {
  return (num / 1000).toFixed(2) * 1
}
function onPay() {
  router.navigate({ url: "/pages/mine/order-pay/index" }, {
    data: {
      id: props.detail.id
    }
  })
}
function toDetail() {
  if (props.detail.status == "1" && props.detail.deposit_status == '0') {
    router.navigate({ url: "/pages/mine/order-pay/index" }, {
      data: {
        id: props.detail.id
      }
    })
  } else {
    router.navigate({ url: "/pages/mine/order-detail/index" }, {
      data: {
        id: props.detail.id
      }
    })
  }
}
</script>

<style lang="less" scoped>
@import url("./index.less");
</style>
